Most electronic mail (email) providers provide a filtering service to remove or flag junk email, known as spam, from a user's mailbox. Email providers establish filtering rules that evaluate regular expressions in a message to identify one or more characteristics of spam. For example, rules may look for names of pharmaceutical products, sexual content, or gibberish in the body of an email message, and may remove messages that contain such content. The number of rules needed to identify spam grows as spam senders try to work around established rules. Evaluating every rule against a message therefore uses more time and processing resources as the number of rules grows. Evaluating every rule against a message is also inefficient, as not all rules will be applicable to a given message. It is with respect to these and other considerations that the present improvements have been needed.